import algorithm, sequtils
type 
  Student = tuple[name: string, grade: int]
  School* = object
    students*: seq[Student]

proc orderedStudent(school: School): seq[Student] = 
  school.students.sortedByIt((it.grade, it.name))

proc roster*(school: School): seq[string] =
  school.orderedStudent.mapIt(it.name)

proc grade*(school: School, num: int): seq[string] =
  school.students.filterIt(it.grade == num).mapIt(it.name).sorted
